<?php

namespace addons\qingdongams\model;

use think\Exception;
use think\Model;

/**
 *  ocr识别
 */
class Ocr Extends Model {
    protected $name = 'qingdongams_ocr';
	// 开启自动写入时间戳字段
	protected $autoWriteTimestamp = 'int';
	// 定义时间戳字段名
	protected $createTime = 'createtime';
	protected $updateTime = 'updatetime';


    //获取创建时间
    public function getCreatetimeAttr($value) {
        return date('Y-m-d H:i:s', $value);
    }

    //获取附件
    public function getFileidsAttr($value) {
       return cdnurl(File::getUrl($value), true);
    }


	//销售
	public function staff() {
		return $this->hasOne(Staff::class, 'id', 'staff_id')->field('id,img,name');
	}


	//类型
	public function types() {
		return $this->hasOne(OcrType::class, 'id', 'type_id')->field('id,name');
	}
}
